package com.poc.train.service.impl;

import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.bstek.dorado.data.provider.Page;
import com.poc.train.dao.PocUserDao;
import com.poc.train.dao.PocUserJdbcDao;
import com.poc.train.entity.PocUser;
import com.poc.train.service.PocUserService;

/**
 * ҵ���߼�ʵ�ֲ�
 * @author Andy
 *
 */
@Service
public class PocUserServiceImpl implements PocUserService {
	
	@Autowired
	private PocUserDao pocUserDao;
	
	@Autowired
	private PocUserJdbcDao userJdbcDao;
	
	

	public void pageUser(Page<PocUser> page, Map<String, Object> parameter) throws Exception {
		pocUserDao.pageUser(page,parameter);
	}

	/**
	 * ��������״̬���в���
	 */
	@Transactional
	public void saveData(Collection<PocUser> datas) throws Exception {
		pocUserDao.saveData(datas);
	}

	public void addData(PocUser user) {
		pocUserDao.addData(user);
	}

	@Override
	public String delData(String userId) {
		userJdbcDao.delData(userId);
		return null;
	}

	@Override
	public List<PocUser> listByPosition(String positionId) {
		Map<String, Object> args = new HashMap<String, Object>();
		args.put("positionId", positionId);
		
		return pocUserDao.listUser(args);
	}

	@Override
	public List<PocUser> listByDdept(String deptId) {
		Map<String, Object> args = new HashMap<String, Object>();
		args.put("deptId", deptId);
		
		return pocUserDao.listUser(args);
	}

}
